from sqlalchemy import Column, DateTime, Text, text
from sqlalchemy.dialects.mysql import INTEGER, TINYTEXT
from sqlalchemy.ext.declarative import declarative_base

Base = declarative_base()
metadata = Base.metadata


class Log(Base):
    __tablename__ = 'log'

    id = Column(INTEGER(11), primary_key=True, autoincrement=True)
    method = Column(TINYTEXT)
    addr = Column(TINYTEXT)
    ua = Column(Text)
    url = Column(TINYTEXT)
    time = Column(DateTime, server_default=text("current_timestamp()"))
    data = Column(TINYTEXT)
